package uk.org.landeg.euler.problems;

import java.util.Map;

import uk.org.landeg.euler.problems.framework.AbstractProblem;
import uk.org.landeg.euler.problems.framework.ProblemLauncher;
import uk.org.landeg.euler.problems.lib.NumbersLib;

public class Problem003 extends AbstractProblem{
	public static void main(String[] args) {
		ProblemLauncher launcher = new ProblemLauncher(new Problem003());
		launcher.solve();
	}
	
	@Override
	public String getDescription() {
		return "What is the largest prime factor of the number 600851475143";
	}

	@Override
	public Integer getProblemNumber() {
		return 3;
	}

	@Override
	public Object solve() {
		Map<Long, Integer> factors = NumbersLib.factorise(600851475143L); 
		notes.add("Factors for 600851475143 are : " + factors);
		Long max = 0l;
		for (Long l : factors.keySet()) {
			max = (max < l) ? l : max;
		}
		return max;
	}
	
}
